package com.lej.push.service

import android.content.Context
import com.lej.core.common.LogTags
import com.lej.core.common.PCacheInfo
import com.lej.core.utils.extention.logI
import com.lej.push.PushUtils
import com.vivo.push.model.UPSNotificationMessage
import com.vivo.push.model.UnvarnishedMessage
import com.vivo.push.sdk.OpenClientPushMessageReceiver

class VIVOPushMessageReceiverImpl : OpenClientPushMessageReceiver() {
    /***
     *
     * 当通知被点击时回调此方法
     *
     * @param context 应用上下文
     *
     * @param msg 通知详情，详细信息见API接入文档
     */
    override fun onNotificationMessageClicked(context: Context?, msg: UPSNotificationMessage?) {}

    override fun onTransmissionMessage(context: Context?, unvarnishedMessage: UnvarnishedMessage?) {
        super.onTransmissionMessage(context, unvarnishedMessage)
    }

    /***
     *
     * 当首次turnOnPush成功或regId发生改变时，回调此方法
     *
     * 如需获取regId，请使用PushClient.getInstance(context).getRegId()
     *
     * @param context 应用上下文
     *
     * @param regId 注册id
     */
    override fun onReceiveRegId(context: Context?, regId: String?) {
        "vivo推送Token".logI(LogTags.push)
        regId?.logI(LogTags.push)
        if (!regId.isNullOrEmpty()) {
            PCacheInfo.clientId = regId
            if (PushUtils.shouldBindClientId) PushUtils.bindCid()
        }
    }
}